<%--
 * action-1.jsp
 *
 * Copyright (C) 2013 Universidad de Sevilla
 * 
 * The use of this project is hereby constrained to the conditions of the 
 * TDG Licence, a copy of which you may download from 
 * http://www.tdg-seville.info/License.html
 --%>

<%@page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>

<%@taglib prefix="jstl" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@taglib prefix="security"
	uri="http://www.springframework.org/security/tags"%>
<%@taglib prefix="display" uri="http://displaytag.sf.net"%>
<%@taglib prefix="acme" tagdir="/WEB-INF/tags"%>

<display:table pagesize="5" class="displaytag" keepStatus="true"
	name="availableItems" requestURI="${requestURI}" id="row">

	<spring:message code="availableItem.seller" var="sellerHeader" />
	<display:column property="seller.name" title="${sellerHeader}"
		sortable="false" />

	<spring:message code="availableItem.referenceNumber"
		var="referenceNumberHeader" />
	<display:column property="referenceNumber"
		title="${referenceNumberHeader}" sortable="false" />

	<spring:message code="availableItem.name" var="nameHeader" />
	<display:column property="name" title="${nameHeader}" sortable="true" />

	<spring:message code="availableItem.units" var="availableUnitsHeader" />
	<display:column property="availableUnits"
		title="${availableUnitsHeader}" sortable="true" />

	<spring:message code="availableItem.state" var="stateHeader" />
	<display:column property="state" title="${stateHeader}"
		sortable="true" />

	<spring:message code="availableItem.price" var="priceHeader" />
	<display:column property="price" title="${priceHeader}"
		sortable="true" />

	<security:authorize access="hasRole('CUSTOMER')">
		<display:column>
			<a href="availableItem/customer/edit.do?availableItemId=${row.id}"><spring:message
					code="availableItem.view" /></a>
		</display:column>
		<display:column>
			<jstl:if test="${row.seller.id==customerId}">
				<a
					href="comment/customer/listOfOneItem.do?availableItemId=${row.id}"><spring:message
						code="availableItem.comments" /></a>
			</jstl:if>
		</display:column>
	</security:authorize>
</display:table>

<security:authorize access="hasRole('CUSTOMER')">
	<jstl:if test="${isSeller}">
		<a href="availableItem/customer/create.do"><spring:message
				code="availableItem.createNew" /></a>
	</jstl:if>
</security:authorize>

<acme:cancel code="availableItem.goBack" url="${backURI}" />


